package com.system.training.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.system.training.entity.Training;



public interface TrainingRepository extends PagingAndSortingRepository<Training,Long>,JpaSpecificationExecutor<Training>{
	//1.通过解析方法名创建查询
		public Training findById(Long id);
	//	
//		//2.@Query声明查询
//		@Query(value="from User user where user.userName = ?1 and  user.password = ?2")
//		public User findUser(String userName,String password);
	//
//		@Query(value="from User user where user.userName = :userName and  user.password = :password")
//		public User findUser2(@Param("userName")String userName,@Param("password")String password);
	//	
//		//sql语法，加上nativeQuery=true
//		@Query(value="select *  from t_user where userName = ?1",nativeQuery=true)
//		public User findUser3(String userName);
//			
//		@Modifying 
//		@Query(value="update User u set u.password = ?2 where u.id = ?1") 
//		public int updateUser(Long id, String password);
	//	
//		@Modifying 
//		@Query(value="delete User u where u.id  in (:ids)") 
//		public int deleteUser(@Param("ids")Long[] ids);
	//	
//		@Query(value="from Training trainging where training.addess like ?1") 
//		public Page<Training> findAll(String addess ,Pageable pageable);

}
